/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @signatureAlgorithm = 'v2';
  @endpointRule = 'central';
  
  checkConfig(config);
  @endpoint = getEndpoint('linkcard', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddCardToDirectionalGroupRequest {
  addType?: string(name='AddType', example='NEW'),
  apiProduct?: string(name='ApiProduct', description='Linkcard', example='Linkcard'),
  groupId?: string(name='GroupId', example='10000002595'),
  iccidList?: [ string ](name='IccidList'),
  msgNotify?: boolean(name='MsgNotify', example='false'),
  serialNo?: string(name='SerialNo', example='123123'),
}

model AddCardToDirectionalGroupShrinkRequest {
  addType?: string(name='AddType', example='NEW'),
  apiProduct?: string(name='ApiProduct', description='Linkcard', example='Linkcard'),
  groupId?: string(name='GroupId', example='10000002595'),
  iccidListShrink?: string(name='IccidList'),
  msgNotify?: boolean(name='MsgNotify', example='false'),
  serialNo?: string(name='SerialNo', example='123123'),
}

model AddCardToDirectionalGroupResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    result?: boolean(name='Result', example='true'),
    serialNo?: string(name='SerialNo', example='123213'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model AddCardToDirectionalGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddCardToDirectionalGroupResponseBody(name='body'),
}

async function addCardToDirectionalGroupWithOptions(tmpReq: AddCardToDirectionalGroupRequest, runtime: Util.RuntimeOptions): AddCardToDirectionalGroupResponse {
  Util.validateModel(tmpReq);
  var request = new AddCardToDirectionalGroupShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.iccidList)) {
    request.iccidListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.iccidList, 'IccidList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.addType)) {
    query['AddType'] = request.addType;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.iccidListShrink)) {
    query['IccidList'] = request.iccidListShrink;
  }
  if (!Util.isUnset(request.msgNotify)) {
    query['MsgNotify'] = request.msgNotify;
  }
  if (!Util.isUnset(request.serialNo)) {
    query['SerialNo'] = request.serialNo;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.apiProduct)) {
    body['ApiProduct'] = request.apiProduct;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddCardToDirectionalGroup',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addCardToDirectionalGroup(request: AddCardToDirectionalGroupRequest): AddCardToDirectionalGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return addCardToDirectionalGroupWithOptions(request, runtime);
}

model AddDirectionalAddressRequest {
  address?: string(name='Address', example='*.aliyun.com'),
  addressType?: string(name='AddressType', example='Domain'),
  groupId?: string(name='GroupId', example='10000002595'),
  msgNotify?: boolean(name='MsgNotify', example='false'),
  serialNo?: string(name='SerialNo', example='123123'),
  source?: string(name='Source', example='user_defined'),
  urlInsecurityForce?: boolean(name='UrlInsecurityForce'),
}

model AddDirectionalAddressResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model AddDirectionalAddressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddDirectionalAddressResponseBody(name='body'),
}

async function addDirectionalAddressWithOptions(request: AddDirectionalAddressRequest, runtime: Util.RuntimeOptions): AddDirectionalAddressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.address)) {
    query['Address'] = request.address;
  }
  if (!Util.isUnset(request.addressType)) {
    query['AddressType'] = request.addressType;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.msgNotify)) {
    query['MsgNotify'] = request.msgNotify;
  }
  if (!Util.isUnset(request.serialNo)) {
    query['SerialNo'] = request.serialNo;
  }
  if (!Util.isUnset(request.source)) {
    query['Source'] = request.source;
  }
  if (!Util.isUnset(request.urlInsecurityForce)) {
    query['UrlInsecurityForce'] = request.urlInsecurityForce;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddDirectionalAddress',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addDirectionalAddress(request: AddDirectionalAddressRequest): AddDirectionalAddressResponse {
  var runtime = new Util.RuntimeOptions{};
  return addDirectionalAddressWithOptions(request, runtime);
}

model AddDirectionalCardRequest {
  fileUri?: string(name='FileUri', example='https://linkcard-user-online.oss-cn-zhangjiakou.aliyuncs.com/DIRECTIONAL_GROUP/20220811/xxxx.csv'),
  groupId?: string(name='GroupId', example='5'),
  groupName?: string(name='GroupName'),
  orderList?: [ string ](name='OrderList'),
  tagList?: [ string ](name='TagList'),
  uploadMethod?: string(name='UploadMethod', example='TAG'),
  uploadType?: string(name='UploadType', example='ALL'),
}

model AddDirectionalCardShrinkRequest {
  fileUri?: string(name='FileUri', example='https://linkcard-user-online.oss-cn-zhangjiakou.aliyuncs.com/DIRECTIONAL_GROUP/20220811/xxxx.csv'),
  groupId?: string(name='GroupId', example='5'),
  groupName?: string(name='GroupName'),
  orderListShrink?: string(name='OrderList'),
  tagListShrink?: string(name='TagList'),
  uploadMethod?: string(name='UploadMethod', example='TAG'),
  uploadType?: string(name='UploadType', example='ALL'),
}

model AddDirectionalCardResponseBody = {
  code?: string(name='Code', example='200'),
  data?: string(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model AddDirectionalCardResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddDirectionalCardResponseBody(name='body'),
}

async function addDirectionalCardWithOptions(tmpReq: AddDirectionalCardRequest, runtime: Util.RuntimeOptions): AddDirectionalCardResponse {
  Util.validateModel(tmpReq);
  var request = new AddDirectionalCardShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.orderList)) {
    request.orderListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.orderList, 'OrderList', 'json');
  }
  if (!Util.isUnset(tmpReq.tagList)) {
    request.tagListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tagList, 'TagList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.fileUri)) {
    query['FileUri'] = request.fileUri;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!Util.isUnset(request.orderListShrink)) {
    query['OrderList'] = request.orderListShrink;
  }
  if (!Util.isUnset(request.tagListShrink)) {
    query['TagList'] = request.tagListShrink;
  }
  if (!Util.isUnset(request.uploadMethod)) {
    query['UploadMethod'] = request.uploadMethod;
  }
  if (!Util.isUnset(request.uploadType)) {
    query['UploadType'] = request.uploadType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddDirectionalCard',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addDirectionalCard(request: AddDirectionalCardRequest): AddDirectionalCardResponse {
  var runtime = new Util.RuntimeOptions{};
  return addDirectionalCardWithOptions(request, runtime);
}

model AddDirectionalGroupRequest {
  groupName?: string(name='GroupName'),
}

model AddDirectionalGroupResponseBody = {
  code?: string(name='Code', example='200'),
  data?: long(name='Data', example='6'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model AddDirectionalGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddDirectionalGroupResponseBody(name='body'),
}

async function addDirectionalGroupWithOptions(request: AddDirectionalGroupRequest, runtime: Util.RuntimeOptions): AddDirectionalGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddDirectionalGroup',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addDirectionalGroup(request: AddDirectionalGroupRequest): AddDirectionalGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return addDirectionalGroupWithOptions(request, runtime);
}

model AddTagsToCardRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  tagNameList?: [ string ](name='TagNameList'),
}

model AddTagsToCardShrinkRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  tagNameListShrink?: string(name='TagNameList'),
}

model AddTagsToCardResponseBody = {
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      tagId?: string(name='TagId', example='14'),
      tagName?: string(name='TagName'),
    }
  ](name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model AddTagsToCardResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddTagsToCardResponseBody(name='body'),
}

async function addTagsToCardWithOptions(tmpReq: AddTagsToCardRequest, runtime: Util.RuntimeOptions): AddTagsToCardResponse {
  Util.validateModel(tmpReq);
  var request = new AddTagsToCardShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.tagNameList)) {
    request.tagNameListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.tagNameList, 'TagNameList', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.tagNameListShrink)) {
    query['TagNameList'] = request.tagNameListShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddTagsToCard',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addTagsToCard(request: AddTagsToCardRequest): AddTagsToCardResponse {
  var runtime = new Util.RuntimeOptions{};
  return addTagsToCardWithOptions(request, runtime);
}

model BatchAddDirectionalAddressRequest {
  addressType?: string(name='AddressType', example='Domain'),
  groupId?: long(name='GroupId', example='5'),
  listAddress?: [ string ](name='ListAddress'),
  source?: string(name='Source', example='user_defined'),
}

model BatchAddDirectionalAddressResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model BatchAddDirectionalAddressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BatchAddDirectionalAddressResponseBody(name='body'),
}

async function batchAddDirectionalAddressWithOptions(request: BatchAddDirectionalAddressRequest, runtime: Util.RuntimeOptions): BatchAddDirectionalAddressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.addressType)) {
    query['AddressType'] = request.addressType;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.listAddress)) {
    query['ListAddress'] = request.listAddress;
  }
  if (!Util.isUnset(request.source)) {
    query['Source'] = request.source;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'BatchAddDirectionalAddress',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function batchAddDirectionalAddress(request: BatchAddDirectionalAddressRequest): BatchAddDirectionalAddressResponse {
  var runtime = new Util.RuntimeOptions{};
  return batchAddDirectionalAddressWithOptions(request, runtime);
}

model DeleteDirectionalAddressRequest {
  address?: string(name='Address', example='*.aliyun.com'),
  groupId?: string(name='GroupId', example='10000002595'),
  msgNotify?: boolean(name='MsgNotify', example='false'),
  serialNo?: string(name='SerialNo', example='123123'),
}

model DeleteDirectionalAddressResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model DeleteDirectionalAddressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDirectionalAddressResponseBody(name='body'),
}

async function deleteDirectionalAddressWithOptions(request: DeleteDirectionalAddressRequest, runtime: Util.RuntimeOptions): DeleteDirectionalAddressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.address)) {
    query['Address'] = request.address;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.msgNotify)) {
    query['MsgNotify'] = request.msgNotify;
  }
  if (!Util.isUnset(request.serialNo)) {
    query['SerialNo'] = request.serialNo;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDirectionalAddress',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteDirectionalAddress(request: DeleteDirectionalAddressRequest): DeleteDirectionalAddressResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDirectionalAddressWithOptions(request, runtime);
}

model DeleteDirectionalGroupRequest {
  groupId?: string(name='GroupId', example='10000002595'),
}

model DeleteDirectionalGroupResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model DeleteDirectionalGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDirectionalGroupResponseBody(name='body'),
}

async function deleteDirectionalGroupWithOptions(request: DeleteDirectionalGroupRequest, runtime: Util.RuntimeOptions): DeleteDirectionalGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDirectionalGroup',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteDirectionalGroup(request: DeleteDirectionalGroupRequest): DeleteDirectionalGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDirectionalGroupWithOptions(request, runtime);
}

model ForceActivationRequest {
  dateType?: string(name='DateType', example='sameflowcard'),
  iccid?: string(name='Iccid', example='89860321******15668'),
}

model ForceActivationResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model ForceActivationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ForceActivationResponseBody(name='body'),
}

async function forceActivationWithOptions(request: ForceActivationRequest, runtime: Util.RuntimeOptions): ForceActivationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.dateType)) {
    query['DateType'] = request.dateType;
  }
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ForceActivation',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function forceActivation(request: ForceActivationRequest): ForceActivationResponse {
  var runtime = new Util.RuntimeOptions{};
  return forceActivationWithOptions(request, runtime);
}

model GetCardDetailRequest {
  destroyCard?: boolean(name='DestroyCard', example='false'),
  iccid?: string(name='Iccid', example='89860321******15668'),
  instanceId?: string(name='InstanceId', example='411****'),
  showPsim?: boolean(name='ShowPsim', example='false'),
}

model GetCardDetailResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    listPsimCards?: [ 
      {
        apnName?: string(name='ApnName', example='cmiot'),
        certifyStatus?: string(name='CertifyStatus', example='2'),
        iccid?: string(name='Iccid', example='89860321******15668'),
        imsi?: [ string ](name='Imsi'),
        ip?: [ string ](name='Ip'),
        msisdn?: [ string ](name='Msisdn'),
        openSms?: boolean(name='OpenSms', example='true'),
        osStatus?: string(name='OsStatus', example='300'),
        periodAddFlow?: string(name='PeriodAddFlow', example='130.00MB'),
        periodSmsUse?: string(name='PeriodSmsUse', example='0'),
        privateNetworkSegment?: string(name='PrivateNetworkSegment', example='*.2.*.4'),
        status?: string(name='Status', example='35'),
        vendor?: string(name='Vendor', example='CMCC'),
      }
    ](name='ListPsimCards'),
    vsimCardInfo?: {
      activeTime?: string(name='ActiveTime', example='2021-11-16 16:35:50'),
      activeType?: string(name='ActiveType', example='first_data_record'),
      aliFee?: string(name='AliFee', example='ali_2'),
      aliyunOrderId?: string(name='AliyunOrderId', example='211519634******'),
      apnName?: string(name='ApnName', example='cmiot'),
      autoLimitResume?: boolean(name='AutoLimitResume', example='true'),
      autoRebindReuse?: boolean(name='AutoRebindReuse', example='false'),
      cardLimitSpeedThreshold?: int32(name='CardLimitSpeedThreshold', example='1024'),
      cardLimitStopThreshold?: int32(name='CardLimitStopThreshold', example='20480'),
      certifyStatus?: string(name='CertifyStatus', example='2'),
      certifyType?: string(name='CertifyType', example='enterprise'),
      credentialInstanceId?: string(name='CredentialInstanceId', example='2622***'),
      credentialLimitSpeedThreshold?: int32(name='CredentialLimitSpeedThreshold', example='1024'),
      credentialLimitStopThreshold?: int32(name='CredentialLimitStopThreshold', example='20480'),
      credentialNo?: string(name='CredentialNo', example='CM-***-*-2-**M'),
      credentialType?: string(name='CredentialType', example='CT-SC-M-1-30M'),
      dataLevel?: string(name='DataLevel', example='30MB'),
      dataType?: string(name='DataType', example='sameflowcard'),
      deviceImei?: string(name='DeviceImei', example='11111111******'),
      directionalGroupId?: string(name='DirectionalGroupId', example='22'),
      directionalGroupName?: string(name='DirectionalGroupName'),
      expireTime?: string(name='ExpireTime', example='2022-04-30 23:59:59'),
      flowThresholdUnit?: string(name='FlowThresholdUnit', example='KB'),
      iccid?: string(name='Iccid', example='89860321******15668'),
      imsi?: [ string ](name='Imsi'),
      ip?: [ string ](name='Ip'),
      isAutoRecharge?: boolean(name='IsAutoRecharge', example='true'),
      msisdn?: [ string ](name='Msisdn'),
      notifyId?: string(name='NotifyId', example='11111'),
      openAccountTime?: string(name='OpenAccountTime', example='2021-11-29 16:12:14'),
      openSms?: boolean(name='OpenSms', example='true'),
      osStatus?: string(name='OsStatus', example='200'),
      period?: string(name='Period', example='1101'),
      periodAddFlow?: string(name='PeriodAddFlow', example='0KB'),
      periodRestFlow?: string(name='PeriodRestFlow', example='130.00MB'),
      periodSmsUse?: string(name='PeriodSmsUse', example='0'),
      privateNetworkSegment?: string(name='PrivateNetworkSegment', example='1.*.3.*'),
      simType?: string(name='SimType', example='nano'),
      status?: string(name='Status', example='35'),
      tagList?: [ 
        {
          id?: long(name='Id', example='24'),
          tagName?: string(name='TagName'),
        }
      ](name='TagList'),
      vendor?: string(name='Vendor', example='CMCC'),
      vsimInstanceId?: int32(name='VsimInstanceId', example='123456'),
    }(name='VsimCardInfo'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model GetCardDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCardDetailResponseBody(name='body'),
}

async function getCardDetailWithOptions(request: GetCardDetailRequest, runtime: Util.RuntimeOptions): GetCardDetailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.destroyCard)) {
    query['DestroyCard'] = request.destroyCard;
  }
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.showPsim)) {
    query['ShowPsim'] = request.showPsim;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCardDetail',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCardDetail(request: GetCardDetailRequest): GetCardDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCardDetailWithOptions(request, runtime);
}

model GetCardFlowInfoRequest {
  dateList?: [ string ](name='DateList', example='["202110","202111"]'),
  iccid?: string(name='Iccid', example='89860321******15668'),
}

model GetCardFlowInfoResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    listCardMonthFlow?: [ 
      {
        flowCount?: string(name='FlowCount', example='200MB'),
        listDayFlow?: [ 
          {
            day?: string(name='Day', example='20211201'),
            flow?: string(name='Flow', example='100MB'),
          }
        ](name='ListDayFlow'),
        month?: string(name='Month', example='202112'),
      }
    ](name='ListCardMonthFlow'),
    listPackageDTO?: [ 
      {
        effectiveTime?: string(name='EffectiveTime', example='2022-03-20 23:59:59'),
        expireTime?: string(name='ExpireTime', example='2022-04-30 23:59:59'),
        packageName?: string(name='PackageName'),
        remark?: string(name='Remark'),
      }
    ](name='ListPackageDTO'),
    listVendorDetail?: [ 
      {
        netWorkDelay?: string(name='NetWorkDelay', example='20'),
        ratio?: string(name='Ratio', example='80%'),
        signalStrength?: string(name='SignalStrength', example='20'),
        usedFlow?: string(name='UsedFlow', example='100MB'),
        vendor?: string(name='Vendor', example='CMCC'),
      }
    ](name='ListVendorDetail'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model GetCardFlowInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCardFlowInfoResponseBody(name='body'),
}

async function getCardFlowInfoWithOptions(request: GetCardFlowInfoRequest, runtime: Util.RuntimeOptions): GetCardFlowInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.dateList)) {
    query['DateList'] = request.dateList;
  }
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCardFlowInfo',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCardFlowInfo(request: GetCardFlowInfoRequest): GetCardFlowInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCardFlowInfoWithOptions(request, runtime);
}

model GetCardLatestFlowRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
}

model GetCardLatestFlowResponseBody = {
  code?: string(name='Code', example='200'),
  data?: string(name='Data', example='1.00MB'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model GetCardLatestFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCardLatestFlowResponseBody(name='body'),
}

async function getCardLatestFlowWithOptions(request: GetCardLatestFlowRequest, runtime: Util.RuntimeOptions): GetCardLatestFlowResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCardLatestFlow',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCardLatestFlow(request: GetCardLatestFlowRequest): GetCardLatestFlowResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCardLatestFlowWithOptions(request, runtime);
}

model GetCardRealStatusRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  msisdn?: string(name='Msisdn', example='144******1111'),
  serialNo?: [ string ](name='SerialNo'),
}

model GetCardRealStatusShrinkRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  msisdn?: string(name='Msisdn', example='144******1111'),
  serialNoShrink?: string(name='SerialNo'),
}

model GetCardRealStatusResponseBody = {
  code?: string(name='Code', example='200'),
  data?: [ 
    {
      gprs?: boolean(name='Gprs', example='true'),
      iccid?: string(name='Iccid', example='89860321******15668'),
      online?: boolean(name='Online', example='true'),
      serialNo?: string(name='SerialNo', example='4f84******7895'),
      status?: string(name='Status', example='SUCCESS'),
    }
  ](name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model GetCardRealStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCardRealStatusResponseBody(name='body'),
}

async function getCardRealStatusWithOptions(tmpReq: GetCardRealStatusRequest, runtime: Util.RuntimeOptions): GetCardRealStatusResponse {
  Util.validateModel(tmpReq);
  var request = new GetCardRealStatusShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.serialNo)) {
    request.serialNoShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.serialNo, 'SerialNo', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.msisdn)) {
    query['Msisdn'] = request.msisdn;
  }
  if (!Util.isUnset(request.serialNoShrink)) {
    query['SerialNo'] = request.serialNoShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCardRealStatus',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCardRealStatus(request: GetCardRealStatusRequest): GetCardRealStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCardRealStatusWithOptions(request, runtime);
}

model GetCardStatusStatisticsResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    errorStopStatisticsDTO?: {
      poolCount?: long(name='PoolCount', example='10'),
      sameFlowCardCount?: long(name='SameFlowCardCount', example='30'),
      singleCardCount?: long(name='SingleCardCount', example='20'),
      totalCount?: long(name='TotalCount', example='60'),
    }(name='ErrorStopStatisticsDTO'),
    exhaustStopStatisticsDTO?: {
      poolCount?: long(name='PoolCount', example='10'),
      sameFlowCardCount?: long(name='SameFlowCardCount', example='30'),
      singleCardCount?: long(name='SingleCardCount', example='20'),
      totalCount?: long(name='TotalCount', example='60'),
    }(name='ExhaustStopStatisticsDTO'),
    expireStopStatisticsDTO?: {
      poolCount?: long(name='PoolCount', example='10'),
      sameFlowCardCount?: long(name='SameFlowCardCount', example='30'),
      singleCardCount?: long(name='SingleCardCount', example='20'),
      totalCount?: long(name='TotalCount', example='60'),
    }(name='ExpireStopStatisticsDTO'),
    flowOutStatisticsDTO?: {
      poolCount?: long(name='PoolCount', example='10'),
      sameFlowCardCount?: long(name='SameFlowCardCount', example='30'),
      singleCardCount?: long(name='SingleCardCount', example='20'),
      totalCount?: long(name='TotalCount', example='60'),
    }(name='FlowOutStatisticsDTO'),
    manageStopStatisticsDTO?: {
      poolCount?: long(name='PoolCount', example='10'),
      sameFlowCardCount?: long(name='SameFlowCardCount', example='30'),
      singleCardCount?: long(name='SingleCardCount', example='20'),
      totalCount?: long(name='TotalCount', example='60'),
    }(name='ManageStopStatisticsDTO'),
    riskWaringStatisticsDTO?: {
      leftFlowPercentageWarnCount?: long(name='LeftFlowPercentageWarnCount', example='40'),
      stopCount?: long(name='StopCount', example='40'),
      waringTotalCount?: long(name='WaringTotalCount', example='100'),
      warningCount?: long(name='WarningCount', example='20'),
    }(name='RiskWaringStatisticsDTO'),
    singCardPeriodLeftFlowWarnDTO?: {
      lessFlowPercentage10Count?: long(name='LessFlowPercentage10Count', example='5'),
      lessFlowPercentage30Count?: long(name='LessFlowPercentage30Count', example='8'),
    }(name='SingCardPeriodLeftFlowWarnDTO'),
    unCertifiedStopStatisticsDTO?: {
      poolCount?: long(name='PoolCount', example='10'),
      sameFlowCardCount?: long(name='SameFlowCardCount', example='30'),
      singleCardCount?: long(name='SingleCardCount', example='20'),
      totalCount?: long(name='TotalCount', example='60'),
    }(name='UnCertifiedStopStatisticsDTO'),
    unbindResumeStatisticsDTO?: {
      poolCount?: long(name='PoolCount', example='10'),
      sameFlowCardCount?: long(name='SameFlowCardCount', example='30'),
      singleCardCount?: long(name='SingleCardCount', example='20'),
      totalCount?: long(name='TotalCount', example='60'),
    }(name='UnbindResumeStatisticsDTO'),
    weekWarnStatisticsDTO?: {
      poolCount?: long(name='PoolCount', example='10'),
      sameFlowCardCount?: long(name='SameFlowCardCount', example='30'),
      singleCardCount?: long(name='SingleCardCount', example='20'),
      totalCount?: long(name='TotalCount', example='60'),
    }(name='WeekWarnStatisticsDTO'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model GetCardStatusStatisticsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCardStatusStatisticsResponseBody(name='body'),
}

async function getCardStatusStatisticsWithOptions(runtime: Util.RuntimeOptions): GetCardStatusStatisticsResponse {
  var req = new OpenApi.OpenApiRequest{};
  var params = new OpenApi.Params{
    action = 'GetCardStatusStatistics',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCardStatusStatistics(): GetCardStatusStatisticsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCardStatusStatisticsWithOptions(runtime);
}

model GetCredentialPoolStatisticsRequest {
  credentialNO?: string(name='CredentialNO', example='CM-SF-M-2-12G'),
  date?: string(name='Date', example='202108'),
}

model GetCredentialPoolStatisticsResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    cardActiveNum?: long(name='CardActiveNum', example='10'),
    cardTotalNum?: long(name='CardTotalNum', example='20'),
    credentialInstanceId?: string(name='CredentialInstanceId', example='259****'),
    credentialNO?: string(name='CredentialNO', example='CM-SF-M-2-12G'),
    credentialType?: string(name='CredentialType', example='CT-SC-M-1-30M'),
    effectiveAvailableFlow?: string(name='EffectiveAvailableFlow', example='6.00GB'),
    effectiveTotalFlow?: string(name='EffectiveTotalFlow', example='12.00GB'),
    monthExceedFee?: long(name='MonthExceedFee'),
    monthFeatureFee?: long(name='MonthFeatureFee', example='100'),
    monthUsedAmount?: long(name='MonthUsedAmount', example='3.00GB'),
    poolAvaiable?: string(name='PoolAvaiable', example='6.00GB'),
    poolGrandTotal?: string(name='PoolGrandTotal', example='12.00GB'),
    poolGrandTotalUsed?: string(name='PoolGrandTotalUsed', example='6.00GB'),
    poolOutUsed?: string(name='PoolOutUsed', example='0KB'),
    poolUsed?: string(name='PoolUsed', example='0KB'),
    smsUsed?: long(name='SmsUsed', example='0'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model GetCredentialPoolStatisticsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCredentialPoolStatisticsResponseBody(name='body'),
}

async function getCredentialPoolStatisticsWithOptions(request: GetCredentialPoolStatisticsRequest, runtime: Util.RuntimeOptions): GetCredentialPoolStatisticsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.credentialNO)) {
    query['CredentialNO'] = request.credentialNO;
  }
  if (!Util.isUnset(request.date)) {
    query['Date'] = request.date;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCredentialPoolStatistics',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCredentialPoolStatistics(request: GetCredentialPoolStatisticsRequest): GetCredentialPoolStatisticsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCredentialPoolStatisticsWithOptions(request, runtime);
}

model GetOperateResultRequest {
  apiProduct?: string(name='ApiProduct'),
  resId?: string(name='ResId'),
  serialNo?: string(name='SerialNo'),
}

model GetOperateResultResponseBody = {
  code?: string(name='Code'),
  data?: {
    executeResult?: string(name='ExecuteResult'),
    operateType?: string(name='OperateType'),
    result?: boolean(name='Result'),
    status?: string(name='Status'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetOperateResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetOperateResultResponseBody(name='body'),
}

async function getOperateResultWithOptions(request: GetOperateResultRequest, runtime: Util.RuntimeOptions): GetOperateResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.apiProduct)) {
    query['ApiProduct'] = request.apiProduct;
  }
  if (!Util.isUnset(request.resId)) {
    query['ResId'] = request.resId;
  }
  if (!Util.isUnset(request.serialNo)) {
    query['SerialNo'] = request.serialNo;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetOperateResult',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getOperateResult(request: GetOperateResultRequest): GetOperateResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return getOperateResultWithOptions(request, runtime);
}

model GetRealNameStatusRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  listMsisdns?: [ string ](name='ListMsisdns'),
}

model GetRealNameStatusShrinkRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  listMsisdnsShrink?: string(name='ListMsisdns'),
}

model GetRealNameStatusResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    desc?: string(name='Desc'),
    realNameStatus?: string(name='RealNameStatus', example='CERTIFIED'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model GetRealNameStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRealNameStatusResponseBody(name='body'),
}

async function getRealNameStatusWithOptions(tmpReq: GetRealNameStatusRequest, runtime: Util.RuntimeOptions): GetRealNameStatusResponse {
  Util.validateModel(tmpReq);
  var request = new GetRealNameStatusShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.listMsisdns)) {
    request.listMsisdnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.listMsisdns, 'ListMsisdns', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.listMsisdnsShrink)) {
    query['ListMsisdns'] = request.listMsisdnsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRealNameStatus',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRealNameStatus(request: GetRealNameStatusRequest): GetRealNameStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRealNameStatusWithOptions(request, runtime);
}

model GetSimCardStateDistributionRequest {
  credentialNO?: string(name='CredentialNO', example='CT-SC-M-2-100M'),
  date?: string(name='Date', example='202209'),
}

model GetSimCardStateDistributionResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    cardCount?: long(name='CardCount', example='100'),
    destoryedCount?: long(name='DestoryedCount', example='0'),
    shutDownCount?: long(name='ShutDownCount', example='10'),
    stopCount?: long(name='StopCount', example='5'),
    testCount?: long(name='TestCount', example='20'),
    unusedCount?: long(name='UnusedCount', example='10'),
    usingCount?: long(name='UsingCount', example='50'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model GetSimCardStateDistributionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSimCardStateDistributionResponseBody(name='body'),
}

async function getSimCardStateDistributionWithOptions(request: GetSimCardStateDistributionRequest, runtime: Util.RuntimeOptions): GetSimCardStateDistributionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.credentialNO)) {
    query['CredentialNO'] = request.credentialNO;
  }
  if (!Util.isUnset(request.date)) {
    query['Date'] = request.date;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSimCardStateDistribution',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getSimCardStateDistribution(request: GetSimCardStateDistributionRequest): GetSimCardStateDistributionResponse {
  var runtime = new Util.RuntimeOptions{};
  return getSimCardStateDistributionWithOptions(request, runtime);
}

model ListCardInfoRequest {
  activeTimeEnd?: string(name='ActiveTimeEnd', example='2022-05-25 23:59:59'),
  activeTimeStart?: string(name='ActiveTimeStart', example='2022-05-25 23:59:59'),
  aliFee?: string(name='AliFee', example='ali_2'),
  aliyunOrderId?: string(name='AliyunOrderId', example='211519634******'),
  apnName?: string(name='ApnName', example='cmiot'),
  certifyType?: string(name='CertifyType', example='enterprise'),
  credentialNo?: string(name='CredentialNo', example='CM-***-*-2-**M'),
  dataLevel?: string(name='DataLevel', example='30MB'),
  dataType?: string(name='DataType', example='sameflowcard'),
  directionalGroupId?: string(name='DirectionalGroupId', example='22'),
  expireTimeEnd?: string(name='ExpireTimeEnd', example='2022-05-25 23:59:59'),
  expireTimeStart?: string(name='ExpireTimeStart', example='2022-05-25 23:59:59'),
  iccid?: string(name='Iccid', example='89860321******15668'),
  imsi?: string(name='Imsi', example='460081937******'),
  isAutoRecharge?: boolean(name='IsAutoRecharge', example='true'),
  maxFlow?: string(name='MaxFlow', example='30'),
  maxRestFlowPercentage?: double(name='MaxRestFlowPercentage', example='0.2'),
  minFlow?: string(name='MinFlow', example='20'),
  msisdn?: string(name='Msisdn', example='1440993******'),
  networkType?: string(name='NetworkType'),
  notifyId?: string(name='NotifyId', example='11111'),
  osStatus?: string(name='OsStatus', example='300'),
  pageNo?: int32(name='PageNo', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  period?: string(name='Period', example='1101'),
  poolId?: string(name='PoolId', example='test1'),
  simType?: string(name='SimType', example='nano'),
  status?: string(name='Status', example='35'),
  tagName?: string(name='TagName'),
  vendor?: string(name='Vendor', example='CMCC'),
}

model ListCardInfoResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    list?: [ 
      {
        activeTime?: string(name='ActiveTime', example='2021-11-16 16:35:50'),
        activeType?: string(name='ActiveType', example='first_data_record'),
        aliFee?: string(name='AliFee', example='ali_2'),
        aliyunOrderId?: string(name='AliyunOrderId', example='211519634******'),
        apnName?: string(name='ApnName', example='cmiot'),
        certifyType?: string(name='CertifyType', example='enterprise'),
        credentialInstanceId?: string(name='CredentialInstanceId', example='2622***'),
        credentialNo?: string(name='CredentialNo', example='CM-***-*-2-**M'),
        credentialType?: string(name='CredentialType', example='unityPayPool'),
        dataLevel?: string(name='DataLevel', example='30MB'),
        dataType?: string(name='DataType', example='sameflowcard'),
        directionalGroupId?: long(name='DirectionalGroupId', example='55'),
        directionalGroupName?: string(name='DirectionalGroupName'),
        expireTime?: string(name='ExpireTime', example='2022-04-30 23:59:59'),
        flowLatestModifiedTime?: string(name='FlowLatestModifiedTime'),
        iccid?: string(name='Iccid', example='89860321******15668'),
        imsi?: [ string ](name='Imsi'),
        isAutoRecharge?: boolean(name='IsAutoRecharge', example='true'),
        msisdn?: [ string ](name='Msisdn'),
        networkType?: string(name='NetworkType'),
        notifyId?: string(name='NotifyId', example='11111'),
        openAccountTime?: string(name='OpenAccountTime', example='2021-11-29 16:12:14'),
        osStatus?: string(name='OsStatus', example='300'),
        period?: string(name='Period', example='1101'),
        periodAddFlow?: string(name='PeriodAddFlow', example='0KB'),
        periodRestFlow?: string(name='PeriodRestFlow', example='130.00MB'),
        periodSmsUse?: string(name='PeriodSmsUse', example='0'),
        privateNetworkSegment?: string(name='PrivateNetworkSegment', example='1.*.3.*'),
        remark?: string(name='Remark'),
        simType?: string(name='SimType', example='nano'),
        status?: string(name='Status', example='35'),
        tagList?: [ 
          {
            id?: long(name='Id', example='24'),
            tagName?: string(name='TagName'),
          }
        ](name='TagList'),
        vendor?: string(name='Vendor', example='CMCC'),
        vsimInstanceId?: long(name='VsimInstanceId', example='123456'),
      }
    ](name='List'),
    pageCount?: int32(name='PageCount', example='20'),
    pageNo?: int32(name='PageNo', example='1'),
    pageSize?: int32(name='PageSize', example='10'),
    total?: int32(name='Total', example='199'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model ListCardInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListCardInfoResponseBody(name='body'),
}

async function listCardInfoWithOptions(request: ListCardInfoRequest, runtime: Util.RuntimeOptions): ListCardInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.activeTimeEnd)) {
    query['ActiveTimeEnd'] = request.activeTimeEnd;
  }
  if (!Util.isUnset(request.activeTimeStart)) {
    query['ActiveTimeStart'] = request.activeTimeStart;
  }
  if (!Util.isUnset(request.aliFee)) {
    query['AliFee'] = request.aliFee;
  }
  if (!Util.isUnset(request.aliyunOrderId)) {
    query['AliyunOrderId'] = request.aliyunOrderId;
  }
  if (!Util.isUnset(request.apnName)) {
    query['ApnName'] = request.apnName;
  }
  if (!Util.isUnset(request.certifyType)) {
    query['CertifyType'] = request.certifyType;
  }
  if (!Util.isUnset(request.credentialNo)) {
    query['CredentialNo'] = request.credentialNo;
  }
  if (!Util.isUnset(request.dataLevel)) {
    query['DataLevel'] = request.dataLevel;
  }
  if (!Util.isUnset(request.dataType)) {
    query['DataType'] = request.dataType;
  }
  if (!Util.isUnset(request.directionalGroupId)) {
    query['DirectionalGroupId'] = request.directionalGroupId;
  }
  if (!Util.isUnset(request.expireTimeEnd)) {
    query['ExpireTimeEnd'] = request.expireTimeEnd;
  }
  if (!Util.isUnset(request.expireTimeStart)) {
    query['ExpireTimeStart'] = request.expireTimeStart;
  }
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.imsi)) {
    query['Imsi'] = request.imsi;
  }
  if (!Util.isUnset(request.isAutoRecharge)) {
    query['IsAutoRecharge'] = request.isAutoRecharge;
  }
  if (!Util.isUnset(request.maxFlow)) {
    query['MaxFlow'] = request.maxFlow;
  }
  if (!Util.isUnset(request.maxRestFlowPercentage)) {
    query['MaxRestFlowPercentage'] = request.maxRestFlowPercentage;
  }
  if (!Util.isUnset(request.minFlow)) {
    query['MinFlow'] = request.minFlow;
  }
  if (!Util.isUnset(request.msisdn)) {
    query['Msisdn'] = request.msisdn;
  }
  if (!Util.isUnset(request.networkType)) {
    query['NetworkType'] = request.networkType;
  }
  if (!Util.isUnset(request.notifyId)) {
    query['NotifyId'] = request.notifyId;
  }
  if (!Util.isUnset(request.osStatus)) {
    query['OsStatus'] = request.osStatus;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.poolId)) {
    query['PoolId'] = request.poolId;
  }
  if (!Util.isUnset(request.simType)) {
    query['SimType'] = request.simType;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.tagName)) {
    query['TagName'] = request.tagName;
  }
  if (!Util.isUnset(request.vendor)) {
    query['Vendor'] = request.vendor;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCardInfo',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCardInfo(request: ListCardInfoRequest): ListCardInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCardInfoWithOptions(request, runtime);
}

model ListDirectionalAddressRequest {
  groupId?: string(name='GroupId', example='5'),
  pageNo?: int32(name='PageNo', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
}

model ListDirectionalAddressResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    list?: [ 
      {
        address?: string(name='Address', example='*.aliyun.com'),
        addressType?: string(name='AddressType', example='Domain'),
        groupId?: string(name='GroupId', example='5'),
        source?: string(name='Source', example='user_defined'),
        state?: int32(name='State', example='500'),
      }
    ](name='List'),
    pageCount?: int32(name='PageCount', example='9'),
    pageNo?: int32(name='PageNo', example='1'),
    pageSize?: int32(name='PageSize', example='10'),
    total?: int32(name='Total', example='90'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model ListDirectionalAddressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDirectionalAddressResponseBody(name='body'),
}

async function listDirectionalAddressWithOptions(request: ListDirectionalAddressRequest, runtime: Util.RuntimeOptions): ListDirectionalAddressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDirectionalAddress',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listDirectionalAddress(request: ListDirectionalAddressRequest): ListDirectionalAddressResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDirectionalAddressWithOptions(request, runtime);
}

model ListDirectionalDetailRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  pageNo?: int32(name='PageNo', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
}

model ListDirectionalDetailResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    directionalGroupId?: long(name='DirectionalGroupId', example='5'),
    directionalName?: string(name='DirectionalName'),
    paginationResult?: {
      list?: [ 
        {
          address?: string(name='Address', example='*.aliyun.com'),
          addressType?: string(name='AddressType', example='Domain'),
          groupId?: string(name='GroupId', example='5'),
          source?: string(name='Source', example='user_defined'),
          state?: string(name='State', example='500'),
        }
      ](name='List'),
      pageCount?: int32(name='PageCount', example='9'),
      pageNo?: int32(name='PageNo', example='1'),
      pageSize?: int32(name='PageSize', example='10'),
      total?: int32(name='Total', example='90'),
    }(name='PaginationResult'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model ListDirectionalDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDirectionalDetailResponseBody(name='body'),
}

async function listDirectionalDetailWithOptions(request: ListDirectionalDetailRequest, runtime: Util.RuntimeOptions): ListDirectionalDetailResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDirectionalDetail',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listDirectionalDetail(request: ListDirectionalDetailRequest): ListDirectionalDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDirectionalDetailWithOptions(request, runtime);
}

model ListOrderRequest {
  credentialNo?: string(name='CredentialNo'),
  endDate?: string(name='EndDate', example='2022-04-05'),
  orderId?: string(name='OrderId', example='21450******0275'),
  orderStatus?: string(name='OrderStatus', example='processing'),
  orderType?: string(name='OrderType', example='NEW'),
  pageNo?: int32(name='PageNo', example='1'),
  pageSize?: int32(name='PageSize', example='10'),
  startDate?: string(name='StartDate', example='2022-04-05'),
}

model ListOrderResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    list?: [ 
      {
        aliFee?: string(name='AliFee', example='ali_2'),
        apnName?: string(name='ApnName'),
        apnRegion?: string(name='ApnRegion'),
        billingCycle?: string(name='BillingCycle', example='1101'),
        buyNum?: int32(name='BuyNum', example='100'),
        cardPayCount?: int32(name='CardPayCount', example='2022-04-11 16:43:00'),
        credentialNo?: string(name='CredentialNo', example='CM-***-*-2-**M'),
        credentialPackage?: string(name='CredentialPackage', example='AL-UPG-******3_beika4'),
        dataLevel?: string(name='DataLevel', example='30MB'),
        deliveryInfo?: {
          address?: string(name='Address'),
          buyerMessage?: string(name='BuyerMessage'),
          mail?: string(name='Mail', example='xxx@xxx.com'),
          receiver?: string(name='Receiver'),
          zipCode?: string(name='ZipCode', example='100000'),
        }(name='DeliveryInfo'),
        expressNoList?: [ string ](name='ExpressNoList'),
        flowType?: string(name='FlowType', example='singlecard'),
        functionFee?: int32(name='FunctionFee', example='90'),
        networkType?: string(name='NetworkType'),
        orderDetailUrl?: string(name='OrderDetailUrl', example='https://us******60589'),
        orderId?: string(name='OrderId', example='21450******0275'),
        orderInfo?: string(name='OrderInfo', example='123123'),
        orderStatus?: string(name='OrderStatus', example='processing'),
        orderType?: string(name='OrderType', example='NEW'),
        payDuration?: string(name='PayDuration'),
        payTime?: string(name='PayTime', example='2022-04-11 16:43:00'),
        poolCapacity?: string(name='PoolCapacity', example='200'),
        poolCapacityUnit?: string(name='PoolCapacityUnit', example='GB'),
        poolNo?: string(name='PoolNo', example='beika4'),
        resourceQuantity?: long(name='ResourceQuantity'),
        vendor?: string(name='Vendor', example='CMCC'),
      }
    ](name='List'),
    pageCount?: int32(name='PageCount', example='5'),
    pageNo?: int32(name='PageNo', example='1'),
    pageSize?: int32(name='PageSize', example='10'),
    total?: int32(name='Total', example='48'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model ListOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListOrderResponseBody(name='body'),
}

async function listOrderWithOptions(request: ListOrderRequest, runtime: Util.RuntimeOptions): ListOrderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.credentialNo)) {
    query['CredentialNo'] = request.credentialNo;
  }
  if (!Util.isUnset(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.orderId)) {
    query['OrderId'] = request.orderId;
  }
  if (!Util.isUnset(request.orderStatus)) {
    query['OrderStatus'] = request.orderStatus;
  }
  if (!Util.isUnset(request.orderType)) {
    query['OrderType'] = request.orderType;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListOrder',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listOrder(request: ListOrderRequest): ListOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return listOrderWithOptions(request, runtime);
}

model RebindResumeSingleCardRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  optMsisdns?: [ string ](name='OptMsisdns', example='["1112******826","1112******827"]'),
}

model RebindResumeSingleCardShrinkRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  optMsisdnsShrink?: string(name='OptMsisdns', example='["1112******826","1112******827"]'),
}

model RebindResumeSingleCardResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage', example='Iccid cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model RebindResumeSingleCardResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RebindResumeSingleCardResponseBody(name='body'),
}

async function rebindResumeSingleCardWithOptions(tmpReq: RebindResumeSingleCardRequest, runtime: Util.RuntimeOptions): RebindResumeSingleCardResponse {
  Util.validateModel(tmpReq);
  var request = new RebindResumeSingleCardShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.optMsisdns)) {
    request.optMsisdnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.optMsisdns, 'OptMsisdns', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.optMsisdnsShrink)) {
    query['OptMsisdns'] = request.optMsisdnsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RebindResumeSingleCard',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function rebindResumeSingleCard(request: RebindResumeSingleCardRequest): RebindResumeSingleCardResponse {
  var runtime = new Util.RuntimeOptions{};
  return rebindResumeSingleCardWithOptions(request, runtime);
}

model RenewRequest {
  apiProduct?: string(name='ApiProduct', example='linkcard'),
  apiRevision?: string(name='ApiRevision', example='2021-05-20'),
  buyNum?: int32(name='BuyNum', example='12'),
  iccid?: string(name='Iccid', example='89860321******15668'),
  offerCode?: string(name='OfferCode', example='COM***0203'),
  rechargeType?: string(name='RechargeType', example='STANDARD'),
  serialNo?: string(name='SerialNo', example='12345678'),
}

model RenewResponseBody = {
  code?: string(name='Code', example='200'),
  data?: {
    orderNo?: string(name='OrderNo', example='21450******0275'),
    serialNo?: string(name='SerialNo', example='12345678'),
  }(name='Data'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model RenewResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RenewResponseBody(name='body'),
}

async function renewWithOptions(request: RenewRequest, runtime: Util.RuntimeOptions): RenewResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.buyNum)) {
    query['BuyNum'] = request.buyNum;
  }
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.offerCode)) {
    query['OfferCode'] = request.offerCode;
  }
  if (!Util.isUnset(request.rechargeType)) {
    query['RechargeType'] = request.rechargeType;
  }
  if (!Util.isUnset(request.serialNo)) {
    query['SerialNo'] = request.serialNo;
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.apiProduct)) {
    body['ApiProduct'] = request.apiProduct;
  }
  if (!Util.isUnset(request.apiRevision)) {
    body['ApiRevision'] = request.apiRevision;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'Renew',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function renew(request: RenewRequest): RenewResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewWithOptions(request, runtime);
}

model ResumeSingleCardRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  optMsisdns?: [ string ](name='OptMsisdns', example='["111******6826","11*******6827"]'),
}

model ResumeSingleCardShrinkRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  optMsisdnsShrink?: string(name='OptMsisdns', example='["111******6826","11*******6827"]'),
}

model ResumeSingleCardResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model ResumeSingleCardResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResumeSingleCardResponseBody(name='body'),
}

async function resumeSingleCardWithOptions(tmpReq: ResumeSingleCardRequest, runtime: Util.RuntimeOptions): ResumeSingleCardResponse {
  Util.validateModel(tmpReq);
  var request = new ResumeSingleCardShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.optMsisdns)) {
    request.optMsisdnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.optMsisdns, 'OptMsisdns', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.optMsisdnsShrink)) {
    query['OptMsisdns'] = request.optMsisdnsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResumeSingleCard',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function resumeSingleCard(request: ResumeSingleCardRequest): ResumeSingleCardResponse {
  var runtime = new Util.RuntimeOptions{};
  return resumeSingleCardWithOptions(request, runtime);
}

model SendMessageRequest {
  apiProduct?: string(name='ApiProduct', description='Linkcard', example='Linkcard'),
  messageSendTime?: long(name='MessageSendTime', example='1694401634'),
  messageTemplateId?: long(name='MessageTemplateId', example='14'),
  messageVariableParam?: string(name='MessageVariableParam'),
  msisdns?: [ string ](name='Msisdns'),
  taskName?: string(name='TaskName'),
}

model SendMessageShrinkRequest {
  apiProduct?: string(name='ApiProduct', description='Linkcard', example='Linkcard'),
  messageSendTime?: long(name='MessageSendTime', example='1694401634'),
  messageTemplateId?: long(name='MessageTemplateId', example='14'),
  messageVariableParam?: string(name='MessageVariableParam'),
  msisdnsShrink?: string(name='Msisdns'),
  taskName?: string(name='TaskName'),
}

model SendMessageResponseBody = {
  code?: string(name='Code', example='200'),
  data?: long(name='Data', example='true'),
  dynamicCode?: string(name='DynamicCode', example='InvokeError'),
  dynamicMessage?: string(name='DynamicMessage'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model SendMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendMessageResponseBody(name='body'),
}

async function sendMessageWithOptions(tmpReq: SendMessageRequest, runtime: Util.RuntimeOptions): SendMessageResponse {
  Util.validateModel(tmpReq);
  var request = new SendMessageShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.msisdns)) {
    request.msisdnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.msisdns, 'Msisdns', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.apiProduct)) {
    body['ApiProduct'] = request.apiProduct;
  }
  if (!Util.isUnset(request.messageSendTime)) {
    body['MessageSendTime'] = request.messageSendTime;
  }
  if (!Util.isUnset(request.messageTemplateId)) {
    body['MessageTemplateId'] = request.messageTemplateId;
  }
  if (!Util.isUnset(request.messageVariableParam)) {
    body['MessageVariableParam'] = request.messageVariableParam;
  }
  if (!Util.isUnset(request.msisdnsShrink)) {
    body['Msisdns'] = request.msisdnsShrink;
  }
  if (!Util.isUnset(request.taskName)) {
    body['TaskName'] = request.taskName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendMessage',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendMessage(request: SendMessageRequest): SendMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendMessageWithOptions(request, runtime);
}

model SetCardStopRuleRequest {
  autoRestore?: boolean(name='AutoRestore', example='true'),
  flowLimit?: long(name='FlowLimit', example='100'),
  iccid?: string(name='Iccid', example='89860321******15668'),
}

model SetCardStopRuleResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model SetCardStopRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SetCardStopRuleResponseBody(name='body'),
}

async function setCardStopRuleWithOptions(request: SetCardStopRuleRequest, runtime: Util.RuntimeOptions): SetCardStopRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.autoRestore)) {
    query['AutoRestore'] = request.autoRestore;
  }
  if (!Util.isUnset(request.flowLimit)) {
    query['FlowLimit'] = request.flowLimit;
  }
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SetCardStopRule',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function setCardStopRule(request: SetCardStopRuleRequest): SetCardStopRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return setCardStopRuleWithOptions(request, runtime);
}

model StopSingleCardRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  optMsisdns?: [ string ](name='OptMsisdns', example='["1112******826","1112******827"]'),
}

model StopSingleCardShrinkRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  optMsisdnsShrink?: string(name='OptMsisdns', example='["1112******826","1112******827"]'),
}

model StopSingleCardResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model StopSingleCardResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopSingleCardResponseBody(name='body'),
}

async function stopSingleCardWithOptions(tmpReq: StopSingleCardRequest, runtime: Util.RuntimeOptions): StopSingleCardResponse {
  Util.validateModel(tmpReq);
  var request = new StopSingleCardShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.optMsisdns)) {
    request.optMsisdnsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.optMsisdns, 'OptMsisdns', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.optMsisdnsShrink)) {
    query['OptMsisdns'] = request.optMsisdnsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopSingleCard',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function stopSingleCard(request: StopSingleCardRequest): StopSingleCardResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopSingleCardWithOptions(request, runtime);
}

model UpdateAutoRechargeSwitchRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
  open?: boolean(name='Open', example='true'),
}

model UpdateAutoRechargeSwitchResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model UpdateAutoRechargeSwitchResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAutoRechargeSwitchResponseBody(name='body'),
}

async function updateAutoRechargeSwitchWithOptions(request: UpdateAutoRechargeSwitchRequest, runtime: Util.RuntimeOptions): UpdateAutoRechargeSwitchResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  if (!Util.isUnset(request.open)) {
    query['Open'] = request.open;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAutoRechargeSwitch',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateAutoRechargeSwitch(request: UpdateAutoRechargeSwitchRequest): UpdateAutoRechargeSwitchResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateAutoRechargeSwitchWithOptions(request, runtime);
}

model VerifyIotCardRequest {
  iccid?: string(name='Iccid', example='89860321******15668'),
}

model VerifyIotCardResponseBody = {
  code?: string(name='Code', example='200'),
  data?: boolean(name='Data', example='true'),
  errorMessage?: string(name='ErrorMessage', example='InstanceId cannot be empty.'),
  localizedMessage?: string(name='LocalizedMessage', example='InstanceId cannot be empty.'),
  requestId?: string(name='RequestId', example='E4F94B97-1D64-4080-BFD2-67461667AA43'),
  success?: boolean(name='Success', example='true'),
}

model VerifyIotCardResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: VerifyIotCardResponseBody(name='body'),
}

async function verifyIotCardWithOptions(request: VerifyIotCardRequest, runtime: Util.RuntimeOptions): VerifyIotCardResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.iccid)) {
    query['Iccid'] = request.iccid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'VerifyIotCard',
    version = '2021-05-20',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function verifyIotCard(request: VerifyIotCardRequest): VerifyIotCardResponse {
  var runtime = new Util.RuntimeOptions{};
  return verifyIotCardWithOptions(request, runtime);
}

